package io.vector.study.algorithm.linkedlist;

import java.util.Objects;

/**
 * Created by vector on 2017/3/17.
 */
public class LinkedNodeImpl<E> implements LinkedNode<E> {

    private E value;

    private LinkedNode<E> next;

    public LinkedNodeImpl(E value) {
        this(value, null);
    }

    public LinkedNodeImpl(E value, LinkedNode<E> next) {
        this.value = value;
        this.next = next;
    }

    @Override
    public E value() {
        return value;
    }

    @Override
    public boolean hasNext() {
        return Objects.nonNull(this.next);
    }

    @Override
    public LinkedNode<E> next() {
        return this.next;
    }

    @Override
    public void next(LinkedNode<E> next) {
        this.next = next;
    }
}
